<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSystemRoles extends \App\Utils\CreateMigration
{
    function columns(Blueprint $table)
    {
        $table->string('name', 50)->comment('角色名称');
        $table->string('group_code', 100)->default('')->comment('分组id');
        $table->string('desc')->nullable()->comment('备注');
        $table->boolean('is_system')->default(0)->comment('是否角色');
        $table->index(['group_code'], 'idx_group_code');
    }

    function tableInfo()
    {
        return ['system__roles', '系统-角色'];
    }

    function getData()
    {
        $date = date('Y-m-d H:i:s');
        return [
            [
                'name' => '超级管理员',
                'group_code' => \App\Models\System\Group::PLAT,
                'desc' => '管理全平台所有内容',
                'is_system' => 1,
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '医院管理员',
                'group_code' => \App\Models\System\Group::HOSPITAL,
                'desc' => '医院管理',
                'is_system' => 1,
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '客服',
                'group_code' => \App\Models\System\Group::CUSTOM_SERVICE,
                'desc' => '客服',
                'is_system' => 1,
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '话务员',
                'group_code' => \App\Models\System\Group::CALLER,
                'desc' => '话务员',
                'is_system' => 1,
                'created_at' => $date,
                'updated_at' => $date
            ]
        ];
    }
}
